<?php

namespace app\libs\AsiabillSDK\builder;

use app\constant\CommonConstant;
use app\model\Orders;

class BuilderBase
{
    protected string $customerId = '';
    protected string $customerPaymentMethodId = '';
    protected string $returnUrl = '';
    const CUSTOMER_CLIENT_IP = '52.36.193.167';
    public function __construct(protected Orders $order)
    {
    }

    public function setCustomerId(string $customerId): BuilderBase
    {
        $this->customerId = $customerId;
        return $this;
    }
    public function getCustomerId():string
    {
        return $this->customerId;
    }

    public function getCustomerPaymentMethodId(): string
    {
        return $this->customerPaymentMethodId;
    }

    public function setCustomerPaymentMethodId(string $customerPaymentMethodId): BuilderBase
    {
        $this->customerPaymentMethodId = $customerPaymentMethodId;
        return $this;
    }

    public function getShipping()
    {
        return [
            'address' => array(
                'line1' => $this->order->shippingAddress->address1,
                'line2' => $this->order->shippingAddress->address2,
                'city' => $this->order->shippingAddress->city,
                'country' => $this->order->shippingAddress->country,
                'state' => $this->order->shippingAddress->province,
                'postalCode' => $this->order->shippingAddress->zip
            ),
            'email' => $this->order->email,
            'firstName' => $this->order->shippingAddress->first_name,
            'lastName' => $this->order->shippingAddress->last_name,
            'phone' => $this->order->shippingAddress->phone,
        ];
    }

    public function setReturnUrl(string $returnUrl): BuilderBase
    {
        $this->returnUrl = $returnUrl;
        return $this;
    }
    public function getReturnUrl():string
    {
        return $this->returnUrl;
    }


}